package com.ltt.controller;

import com.ltt.annotation.NoAuth;
import com.ltt.dao.vo.Result;
import com.ltt.service.WxLoginService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author ‘李天泰’
 * @version 1.0
 * @description: TODO
 * @date 2023/4/30 16:16
 */
@CrossOrigin
@Api(tags = "登录模块")
@RestController
public class WxLoginController {
    @Autowired
    private WxLoginService wxLoginService;


    @NoAuth
    @ApiOperation("登录接口")
    @PostMapping("/login")
    public Result wxLogin(@ApiParam(name = "code",value = "微信方传参数code，返回openid和token") String code){
        return wxLoginService.getUserInfo(code);

    }


    @NoAuth
    @ApiOperation("管理员登录")
    @PostMapping("/admin")
    public Result wxLogin(){
        System.out.println(wxLoginService.adminLogin());
        return wxLoginService.adminLogin();
    }
}
